


set more off
mat drop _all


use "$path_data/data/temp/main_reg_data_psc.dta", clear




foreach i in DT_per_min DT_score DT_time {
replace `i'_pre = . if wrongDT == 1
gen `i'_pre_miss = `i'_pre
gen `i'_dum_miss = 0
replace `i'_dum_miss = 1 if `i'_pre == .
replace `i'_pre_miss = 0 if `i'_pre == .
}

gen pts_pre_miss = ptsbl_overall_score
gen pts_dum_miss = 0
replace pts_dum_miss = 1 if ptsbl_overall_score == .
replace pts_pre_miss = 0 if ptsbl_overall_score == .






foreach i in rosen cpcs {
gen `i'_pre_miss = `i'_bl
gen `i'_dum_miss = 0
replace `i'_dum_miss = 1 if `i'_bl == .
replace `i'_pre_miss = 0 if `i'_bl == .
}






***** Interact treatment with gender and initial cognitive level
********Separate students into 2 groups: above vs. below median level of cognitive test (using baseline DT test score)
sum DT_per_min_pre if grade==2, detail
gen above_dtcog_update=0 if grade==2& !missing(DT_per_min_pre) 
replace above_dtcog_update = 1 if grade==2& DT_per_min_pre>r(p50)& !missing(DT_per_min_pre)
sum DT_per_min_pre if grade==4, detail
replace above_dtcog_update=0 if grade==4 & !missing(DT_per_min_pre)
replace above_dtcog_update = 1 if grade==4 & DT_per_min_pre>r(p50)& !missing(DT_per_min_pre)

sum ptsbl_overall_score if grade==2, detail
gen above_ptcog_update=0 if grade==2& !missing(ptsbl_overall_score)
replace above_ptcog_update = 1 if grade==2& ptsbl_overall_score>r(p50)& !missing(ptsbl_overall_score)
sum ptsbl_overall_score if grade==4, detail
replace above_ptcog_update=0 if grade==4 & !missing(ptsbl_overall_score)
replace above_ptcog_update = 1 if grade==4 & ptsbl_overall_score>r(p50)& !missing(ptsbl_overall_score)


sum rosen_bl if grade==2, detail
gen above_rosen_update=0 if grade==2& !missing(rosen_bl)
replace above_rosen_update = 1 if grade==2& rosen_bl>r(p50)& !missing(rosen_bl)
sum rosen_bl if grade==4, detail
replace above_rosen_update=0 if grade==4 & !missing(rosen_bl)
replace above_rosen_update = 1 if grade==4 & rosen_bl>r(p50)& !missing(rosen_bl)


sum cpcs_bl if grade==2, detail
gen above_cpcs_update=0 if grade==2& !missing(cpcs_bl)
replace above_cpcs_update = 1 if grade==2& cpcs_bl>r(p50)& !missing(cpcs_bl)
sum cpcs_bl if grade==4, detail
replace above_cpcs_update=0 if grade==4 & !missing(cpcs_bl)
replace above_cpcs_update = 1 if grade==4 & cpcs_bl>r(p50)& !missing(cpcs_bl)




*************************************
**************************************
*************************************
*
** Heterogeneous specification  (median measure is pts and rosen/cpcs)
*
**************************************
************************************
**************************************







*HNCr1: [H]eterogeneous [ANC]OVA, [r]osenberg scale, 1 means high-high group



foreach i in DT_per_min DT_score DT_time  {

	 regress `i'_post treatment `i'_pre_miss if `i'_dum_miss == 0 & above_rosen_update == 1 & above_dtcog_update == 1, cluster(school_no)

	matrix HNC1r_`i'_post_temp = r(table)
	matrix HNC1r_`i'_post_r2 = e(r2)
	matrix HNC1r_`i'_post_obs = e(N)

	 cgmwildboot_2 `i'_post treatment `i'_pre_miss if `i'_dum_miss == 0 & above_rosen_update == 1 & above_dtcog_update == 1, cluster(school_no) bootcluster(school_no) null(0 .) reps(999) seed(1)
	matrix HNC1r_`i'_post_temp_p = e(Pvals)

	
	foreach s in be se pv rpv wpv {
		matrix HNC1r_`i'_post_`s' = J(7,1,.)
	}

	foreach j in 1 2 3 4 5 6 7 {
		* beta
		matrix HNC1r_`i'_post_be[`j',1] = HNC1r_`i'_post_temp[1,`j']
		* standard error
		matrix HNC1r_`i'_post_se[`j',1] = HNC1r_`i'_post_temp[2,`j']
		* p value
		matrix HNC1r_`i'_post_pv[`j',1] = HNC1r_`i'_post_temp[4,`j']
		matrix HNC1r_`i'_post_wpv[`j',1] = HNC1r_`i'_post_temp_p[`j',1]
	}

*	cgmwildboot `i' treatment wrongDT cheating wrongTshort wrongTlong dum_grade, ///
*	cluster(school_no) bootcluster(school_no) null(0 . . . . . ) reps(999) seed(1)


	
}

foreach i in ptsel_overall_score {

	 regress `i' treatment pts_pre_miss if pts_dum_miss == 0 & above_rosen_update == 1 & above_ptcog_update == 1, cluster(school_no)

	matrix HNC1r_`i'_temp = r(table)
	matrix HNC1r_`i'_r2 = e(r2)
	matrix HNC1r_`i'_obs = e(N)

	 cgmwildboot_2 `i' treatment pts_pre_miss if pts_dum_miss == 0 &  above_rosen_update == 1 & above_ptcog_update == 1, cluster(school_no) bootcluster(school_no) null(0 .) reps(999) seed(1)
	matrix HNC1r_`i'_temp_p = e(Pvals)

	
	foreach s in be se pv rpv wpv {
		matrix HNC1r_`i'_`s' = J(7,1,.)
	}

	foreach j in 1 2 3 4 5 6 7 {
		* beta
		matrix HNC1r_`i'_be[`j',1] = HNC1r_`i'_temp[1,`j']
		* standard error
		matrix HNC1r_`i'_se[`j',1] = HNC1r_`i'_temp[2,`j']
		* p value
		matrix HNC1r_`i'_pv[`j',1] = HNC1r_`i'_temp[4,`j']
		matrix HNC1r_`i'_wpv[`j',1] = HNC1r_`i'_temp_p[`j',1]
	}

*	cgmwildboot `i' treatment wrongDT cheating wrongTshort wrongTlong dum_grade, ///
*	cluster(school_no) bootcluster(school_no) null(0 . . . . . ) reps(999) seed(1)


	
}




foreach i in rosen cpcs {

	 regress `i'_el treatment `i'_pre_miss if `i'_dum_miss == 0 & above_rosen_update == 1 & above_ptcog_update == 1, cluster(school_no)

	matrix HNC1r_`i'_el_temp = r(table)
	matrix HNC1r_`i'_el_r2 = e(r2)
	matrix HNC1r_`i'_el_obs = e(N)

	 cgmwildboot_2 `i'_el treatment `i'_pre_miss if `i'_dum_miss == 0 & above_rosen_update == 1 & above_ptcog_update == 1, cluster(school_no) bootcluster(school_no) null(0 .) reps(999) seed(1)
	matrix HNC1r_`i'_el_temp_p = e(Pvals)

	
	foreach s in be se pv rpv wpv {
		matrix HNC1r_`i'_el_`s' = J(7,1,.)
	}

	foreach j in 1 2 3 4 5 6 7 {
		* beta
		matrix HNC1r_`i'_el_be[`j',1] = HNC1r_`i'_el_temp[1,`j']
		* standard error
		matrix HNC1r_`i'_el_se[`j',1] = HNC1r_`i'_el_temp[2,`j']
		* p value
		matrix HNC1r_`i'_el_pv[`j',1] = HNC1r_`i'_el_temp[4,`j']
		matrix HNC1r_`i'_el_wpv[`j',1] = HNC1r_`i'_el_temp_p[`j',1]
	}

*	cgmwildboot `i' treatment wrongDT cheating wrongTshort wrongTlong dum_grade, ///
*	cluster(school_no) bootcluster(school_no) null(0 . . . . . ) reps(999) seed(1)


	
}



foreach s in be se pv rpv r2 obs wpv {
	matrix HNC1r_`s' = HNC1r_DT_per_min_post_`s', HNC1r_DT_score_post_`s', ///
	HNC1r_DT_time_post_`s', HNC1r_ptsel_overall_score_`s', ///
	HNC1r_rosen_el_`s', HNC1r_cpcs_el_`s'
}









*HNCr1: [H]eterogeneous [ANC]OVA, [r]osenberg scale, 1 means high-high group



foreach i in DT_per_min DT_score DT_time  {

	 regress `i'_post treatment `i'_pre_miss if `i'_dum_miss == 0 &  above_rosen_update == 0 & above_dtcog_update == 1 , cluster(school_no)

	matrix HNC2r_`i'_post_temp = r(table)
	matrix HNC2r_`i'_post_r2 = e(r2)
	matrix HNC2r_`i'_post_obs = e(N)

	 cgmwildboot_2 `i'_post treatment `i'_pre_miss if `i'_dum_miss == 0 & above_rosen_update == 0 & above_dtcog_update == 1 , cluster(school_no) bootcluster(school_no) null(0 .) reps(999) seed(1)
	matrix HNC2r_`i'_post_temp_p = e(Pvals)

	
	foreach s in be se pv rpv wpv {
		matrix HNC2r_`i'_post_`s' = J(7,1,.)
	}

	foreach j in 1 2 3 4 5 6 7 {
		* beta
		matrix HNC2r_`i'_post_be[`j',1] = HNC2r_`i'_post_temp[1,`j']
		* standard error
		matrix HNC2r_`i'_post_se[`j',1] = HNC2r_`i'_post_temp[2,`j']
		* p value
		matrix HNC2r_`i'_post_pv[`j',1] = HNC2r_`i'_post_temp[4,`j']
		matrix HNC2r_`i'_post_wpv[`j',1] = HNC2r_`i'_post_temp_p[`j',1]
	}

*	cgmwildboot `i' treatment wrongDT cheating wrongTshort wrongTlong dum_grade, ///
*	cluster(school_no) bootcluster(school_no) null(0 . . . . . ) reps(999) seed(1)


	
}

foreach i in ptsel_overall_score {

	 regress `i' treatment pts_pre_miss  if pts_dum_miss == 0 & above_rosen_update == 0 & above_ptcog_update == 1, cluster(school_no)

	matrix HNC2r_`i'_temp = r(table)
	matrix HNC2r_`i'_r2 = e(r2)
	matrix HNC2r_`i'_obs = e(N)

	 cgmwildboot_2 `i' treatment pts_pre_miss  if pts_dum_miss == 0 & above_rosen_update == 0 & above_ptcog_update == 1, cluster(school_no) bootcluster(school_no) null(0 .) reps(999) seed(1)
	matrix HNC2r_`i'_temp_p = e(Pvals)

	
	foreach s in be se pv rpv wpv {
		matrix HNC2r_`i'_`s' = J(7,1,.)
	}

	foreach j in 1 2 3 4 5 6 7 {
		* beta
		matrix HNC2r_`i'_be[`j',1] = HNC2r_`i'_temp[1,`j']
		* standard error
		matrix HNC2r_`i'_se[`j',1] = HNC2r_`i'_temp[2,`j']
		* p value
		matrix HNC2r_`i'_pv[`j',1] = HNC2r_`i'_temp[4,`j']
		matrix HNC2r_`i'_wpv[`j',1] = HNC2r_`i'_temp_p[`j',1]
	}

*	cgmwildboot `i' treatment wrongDT cheating wrongTshort wrongTlong dum_grade, ///
*	cluster(school_no) bootcluster(school_no) null(0 . . . . . ) reps(999) seed(1)


	
}




foreach i in rosen cpcs {

	 regress `i'_el treatment `i'_pre_miss if `i'_dum_miss == 0 &  above_rosen_update == 0 & above_ptcog_update == 1, cluster(school_no)

	matrix HNC2r_`i'_el_temp = r(table)
	matrix HNC2r_`i'_el_r2 = e(r2)
	matrix HNC2r_`i'_el_obs = e(N)

	 cgmwildboot_2 `i'_el treatment `i'_pre_miss if `i'_dum_miss == 0 & above_rosen_update == 0 & above_ptcog_update == 1, cluster(school_no) bootcluster(school_no) null(0 .) reps(999) seed(1)
	matrix HNC2r_`i'_el_temp_p = e(Pvals)

	
	foreach s in be se pv rpv wpv {
		matrix HNC2r_`i'_el_`s' = J(7,1,.)
	}

	foreach j in 1 2 3 4 5 6 7 {
		* beta
		matrix HNC2r_`i'_el_be[`j',1] = HNC2r_`i'_el_temp[1,`j']
		* standard error
		matrix HNC2r_`i'_el_se[`j',1] = HNC2r_`i'_el_temp[2,`j']
		* p value
		matrix HNC2r_`i'_el_pv[`j',1] = HNC2r_`i'_el_temp[4,`j']
		matrix HNC2r_`i'_el_wpv[`j',1] = HNC2r_`i'_el_temp_p[`j',1]
	}

*	cgmwildboot `i' treatment wrongDT cheating wrongTshort wrongTlong dum_grade, ///
*	cluster(school_no) bootcluster(school_no) null(0 . . . . . ) reps(999) seed(1)


	
}



foreach s in be se pv rpv r2 obs wpv {
	matrix HNC2r_`s' = HNC2r_DT_per_min_post_`s', HNC2r_DT_score_post_`s', ///
	HNC2r_DT_time_post_`s', HNC2r_ptsel_overall_score_`s', ///
	HNC2r_rosen_el_`s', HNC2r_cpcs_el_`s'
}









*HNCr1: [H]eterogeneous [ANC]OVA, [r]osenberg scale, 1 means high-high group



foreach i in DT_per_min DT_score DT_time  {

	 regress `i'_post treatment `i'_pre_miss if `i'_dum_miss == 0 & above_rosen_update == 1 & above_dtcog_update == 0 , cluster(school_no)

	matrix HNC3r_`i'_post_temp = r(table)
	matrix HNC3r_`i'_post_r2 = e(r2)
	matrix HNC3r_`i'_post_obs = e(N)

	 cgmwildboot_2 `i'_post treatment `i'_pre_miss if `i'_dum_miss == 0 & above_rosen_update == 1 & above_dtcog_update == 0 , cluster(school_no) bootcluster(school_no) null(0 .) reps(999) seed(1)
	matrix HNC3r_`i'_post_temp_p = e(Pvals)

	
	foreach s in be se pv rpv wpv {
		matrix HNC3r_`i'_post_`s' = J(7,1,.)
	}

	foreach j in 1 2 3 4 5 6 7 {
		* beta
		matrix HNC3r_`i'_post_be[`j',1] = HNC3r_`i'_post_temp[1,`j']
		* standard error
		matrix HNC3r_`i'_post_se[`j',1] = HNC3r_`i'_post_temp[2,`j']
		* p value
		matrix HNC3r_`i'_post_pv[`j',1] = HNC3r_`i'_post_temp[4,`j']
		matrix HNC3r_`i'_post_wpv[`j',1] = HNC3r_`i'_post_temp_p[`j',1]
	}

*	cgmwildboot `i' treatment wrongDT cheating wrongTshort wrongTlong dum_grade, ///
*	cluster(school_no) bootcluster(school_no) null(0 . . . . . ) reps(999) seed(1)


	
}

foreach i in ptsel_overall_score {

	 regress `i' treatment pts_pre_miss if pts_dum_miss == 0 & above_rosen_update == 1 & above_ptcog_update == 0, cluster(school_no)

	matrix HNC3r_`i'_temp = r(table)
	matrix HNC3r_`i'_r2 = e(r2)
	matrix HNC3r_`i'_obs = e(N)

	 cgmwildboot_2 `i' treatment pts_pre_miss if pts_dum_miss == 0 &  above_rosen_update == 1 & above_ptcog_update == 0, cluster(school_no) bootcluster(school_no) null(0 .) reps(999) seed(1)
	matrix HNC3r_`i'_temp_p = e(Pvals)

	
	foreach s in be se pv rpv wpv {
		matrix HNC3r_`i'_`s' = J(7,1,.)
	}

	foreach j in 1 2 3 4 5 6 7 {
		* beta
		matrix HNC3r_`i'_be[`j',1] = HNC3r_`i'_temp[1,`j']
		* standard error
		matrix HNC3r_`i'_se[`j',1] = HNC3r_`i'_temp[2,`j']
		* p value
		matrix HNC3r_`i'_pv[`j',1] = HNC3r_`i'_temp[4,`j']
		matrix HNC3r_`i'_wpv[`j',1] = HNC3r_`i'_temp_p[`j',1]
	}

*	cgmwildboot `i' treatment wrongDT cheating wrongTshort wrongTlong dum_grade, ///
*	cluster(school_no) bootcluster(school_no) null(0 . . . . . ) reps(999) seed(1)


	
}




foreach i in rosen cpcs {

	 regress `i'_el treatment `i'_pre_miss  if `i'_dum_miss == 0 & above_rosen_update == 1 & above_ptcog_update == 0, cluster(school_no)

	matrix HNC3r_`i'_el_temp = r(table)
	matrix HNC3r_`i'_el_r2 = e(r2)
	matrix HNC3r_`i'_el_obs = e(N)

	 cgmwildboot_2 `i'_el treatment `i'_pre_miss if `i'_dum_miss == 0 & above_rosen_update == 1 & above_ptcog_update == 0, cluster(school_no) bootcluster(school_no) null(0 .) reps(999) seed(1)
	matrix HNC3r_`i'_el_temp_p = e(Pvals)

	
	foreach s in be se pv rpv wpv {
		matrix HNC3r_`i'_el_`s' = J(7,1,.)
	}

	foreach j in 1 2 3 4 5 6 7 {
		* beta
		matrix HNC3r_`i'_el_be[`j',1] = HNC3r_`i'_el_temp[1,`j']
		* standard error
		matrix HNC3r_`i'_el_se[`j',1] = HNC3r_`i'_el_temp[2,`j']
		* p value
		matrix HNC3r_`i'_el_pv[`j',1] = HNC3r_`i'_el_temp[4,`j']
		matrix HNC3r_`i'_el_wpv[`j',1] = HNC3r_`i'_el_temp_p[`j',1]
	}

*	cgmwildboot `i' treatment wrongDT cheating wrongTshort wrongTlong dum_grade, ///
*	cluster(school_no) bootcluster(school_no) null(0 . . . . . ) reps(999) seed(1)


	
}



foreach s in be se pv rpv r2 obs wpv {
	matrix HNC3r_`s' = HNC3r_DT_per_min_post_`s', HNC3r_DT_score_post_`s', ///
	HNC3r_DT_time_post_`s', HNC3r_ptsel_overall_score_`s', ///
	HNC3r_rosen_el_`s', HNC3r_cpcs_el_`s'
}








*HNCr1: [H]eterogeneous [ANC]OVA, [r]osenberg scale, 1 means high-high group



foreach i in DT_per_min DT_score DT_time  {

	 regress `i'_post treatment `i'_pre_miss if `i'_dum_miss == 0 &  above_rosen_update == 0 & above_dtcog_update == 0 , cluster(school_no)

	matrix HNC4r_`i'_post_temp = r(table)
	matrix HNC4r_`i'_post_r2 = e(r2)
	matrix HNC4r_`i'_post_obs = e(N)

	 cgmwildboot_2 `i'_post treatment `i'_pre_miss if `i'_dum_miss == 0 &  above_rosen_update == 0 & above_dtcog_update == 0 , cluster(school_no) bootcluster(school_no) null(0 .) reps(999) seed(1)
	matrix HNC4r_`i'_post_temp_p = e(Pvals)

	
	foreach s in be se pv rpv wpv {
		matrix HNC4r_`i'_post_`s' = J(7,1,.)
	}

	foreach j in 1 2 3 4 5 6 7 {
		* beta
		matrix HNC4r_`i'_post_be[`j',1] = HNC4r_`i'_post_temp[1,`j']
		* standard error
		matrix HNC4r_`i'_post_se[`j',1] = HNC4r_`i'_post_temp[2,`j']
		* p value
		matrix HNC4r_`i'_post_pv[`j',1] = HNC4r_`i'_post_temp[4,`j']
		matrix HNC4r_`i'_post_wpv[`j',1] = HNC4r_`i'_post_temp_p[`j',1]
	}

*	cgmwildboot `i' treatment wrongDT cheating wrongTshort wrongTlong dum_grade, ///
*	cluster(school_no) bootcluster(school_no) null(0 . . . . . ) reps(999) seed(1)


	
}

foreach i in ptsel_overall_score {

	 regress `i' treatment pts_pre_miss if pts_dum_miss == 0 &  above_rosen_update == 0 & above_ptcog_update == 0, cluster(school_no)

	matrix HNC4r_`i'_temp = r(table)
	matrix HNC4r_`i'_r2 = e(r2)
	matrix HNC4r_`i'_obs = e(N)

	 cgmwildboot_2 `i' treatment pts_pre_miss if pts_dum_miss == 0 &  above_rosen_update == 0 & above_ptcog_update == 0, cluster(school_no) bootcluster(school_no) null(0 .) reps(999) seed(1)
	matrix HNC4r_`i'_temp_p = e(Pvals)

	
	foreach s in be se pv rpv wpv {
		matrix HNC4r_`i'_`s' = J(7,1,.)
	}

	foreach j in 1 2 3 4 5 6 7 {
		* beta
		matrix HNC4r_`i'_be[`j',1] = HNC4r_`i'_temp[1,`j']
		* standard error
		matrix HNC4r_`i'_se[`j',1] = HNC4r_`i'_temp[2,`j']
		* p value
		matrix HNC4r_`i'_pv[`j',1] = HNC4r_`i'_temp[4,`j']
		matrix HNC4r_`i'_wpv[`j',1] = HNC4r_`i'_temp_p[`j',1]
	}

*	cgmwildboot `i' treatment wrongDT cheating wrongTshort wrongTlong dum_grade, ///
*	cluster(school_no) bootcluster(school_no) null(0 . . . . . ) reps(999) seed(1)


	
}




foreach i in rosen cpcs {

	 regress `i'_el treatment `i'_pre_miss  if `i'_dum_miss == 0 & above_rosen_update == 0 & above_ptcog_update == 0, cluster(school_no)

	matrix HNC4r_`i'_el_temp = r(table)
	matrix HNC4r_`i'_el_r2 = e(r2)
	matrix HNC4r_`i'_el_obs = e(N)

	 cgmwildboot_2 `i'_el treatment `i'_pre_miss  if `i'_dum_miss == 0 & above_rosen_update == 0 & above_ptcog_update == 0, cluster(school_no) bootcluster(school_no) null(0 .) reps(999) seed(1)
	matrix HNC4r_`i'_el_temp_p = e(Pvals)

	
	foreach s in be se pv rpv wpv {
		matrix HNC4r_`i'_el_`s' = J(7,1,.)
	}

	foreach j in 1 2 3 4 5 6 7 {
		* beta
		matrix HNC4r_`i'_el_be[`j',1] = HNC4r_`i'_el_temp[1,`j']
		* standard error
		matrix HNC4r_`i'_el_se[`j',1] = HNC4r_`i'_el_temp[2,`j']
		* p value
		matrix HNC4r_`i'_el_pv[`j',1] = HNC4r_`i'_el_temp[4,`j']
		matrix HNC4r_`i'_el_wpv[`j',1] = HNC4r_`i'_el_temp_p[`j',1]
	}

*	cgmwildboot `i' treatment wrongDT cheating wrongTshort wrongTlong dum_grade, ///
*	cluster(school_no) bootcluster(school_no) null(0 . . . . . ) reps(999) seed(1)


	
}



foreach s in be se pv rpv r2 obs wpv {
	matrix HNC4r_`s' = HNC4r_DT_per_min_post_`s', HNC4r_DT_score_post_`s', ///
	HNC4r_DT_time_post_`s', HNC4r_ptsel_overall_score_`s', ///
	HNC4r_rosen_el_`s', HNC4r_cpcs_el_`s'
}


















*HNC1c: [H]eterogeneous [ANC]OVA, [c]pcs scale, 1 means high-high group



foreach i in DT_per_min DT_score DT_time  {

	 regress `i'_post treatment `i'_pre_miss if `i'_dum_miss == 0 & above_cpcs_update == 1 & above_dtcog_update == 1 , cluster(school_no)

	matrix HNC1c_`i'_post_temp = r(table)
	matrix HNC1c_`i'_post_r2 = e(r2)
	matrix HNC1c_`i'_post_obs = e(N)

	 cgmwildboot_2 `i'_post treatment `i'_pre_miss if `i'_dum_miss == 0 & above_cpcs_update == 1 & above_dtcog_update == 1 , cluster(school_no) bootcluster(school_no) null(0 .) reps(999) seed(1)
	matrix HNC1c_`i'_post_temp_p = e(Pvals)

	
	foreach s in be se pv rpv wpv {
		matrix HNC1c_`i'_post_`s' = J(7,1,.)
	}

	foreach j in 1 2 3 4 5 6 7 {
		* beta
		matrix HNC1c_`i'_post_be[`j',1] = HNC1c_`i'_post_temp[1,`j']
		* standard error
		matrix HNC1c_`i'_post_se[`j',1] = HNC1c_`i'_post_temp[2,`j']
		* p value
		matrix HNC1c_`i'_post_pv[`j',1] = HNC1c_`i'_post_temp[4,`j']
		matrix HNC1c_`i'_post_wpv[`j',1] = HNC1c_`i'_post_temp_p[`j',1]
	}

*	cgmwildboot `i' treatment wrongDT cheating wrongTshort wrongTlong dum_grade, ///
*	cluster(school_no) bootcluster(school_no) null(0 . . . . . ) reps(999) seed(1)


	
}

foreach i in ptsel_overall_score {

	 regress `i' treatment pts_pre_miss if pts_dum_miss == 0 & above_cpcs_update == 1 & above_ptcog_update == 1, cluster(school_no)

	matrix HNC1c_`i'_temp = r(table)
	matrix HNC1c_`i'_r2 = e(r2)
	matrix HNC1c_`i'_obs = e(N)

	 cgmwildboot_2 `i' treatment pts_pre_miss if pts_dum_miss == 0 & above_cpcs_update == 1 & above_ptcog_update == 1, cluster(school_no) bootcluster(school_no) null(0 .) reps(999) seed(1)
	matrix HNC1c_`i'_temp_p = e(Pvals)

	
	foreach s in be se pv rpv wpv {
		matrix HNC1c_`i'_`s' = J(7,1,.)
	}

	foreach j in 1 2 3 4 5 6 7 {
		* beta
		matrix HNC1c_`i'_be[`j',1] = HNC1c_`i'_temp[1,`j']
		* standard error
		matrix HNC1c_`i'_se[`j',1] = HNC1c_`i'_temp[2,`j']
		* p value
		matrix HNC1c_`i'_pv[`j',1] = HNC1c_`i'_temp[4,`j']
		matrix HNC1c_`i'_wpv[`j',1] = HNC1c_`i'_temp_p[`j',1]
	}

*	cgmwildboot `i' treatment wrongDT cheating wrongTshort wrongTlong dum_grade, ///
*	cluster(school_no) bootcluster(school_no) null(0 . . . . . ) reps(999) seed(1)


	
}




foreach i in rosen cpcs {

	 regress `i'_el treatment `i'_pre_miss if `i'_dum_miss == 0 &  above_cpcs_update == 1 & above_ptcog_update == 1, cluster(school_no)

	matrix HNC1c_`i'_el_temp = r(table)
	matrix HNC1c_`i'_el_r2 = e(r2)
	matrix HNC1c_`i'_el_obs = e(N)

	 cgmwildboot_2 `i'_el treatment `i'_pre_miss if `i'_dum_miss == 0 &  above_cpcs_update == 1 & above_ptcog_update == 1, cluster(school_no) bootcluster(school_no) null(0 .) reps(999) seed(1)
	matrix HNC1c_`i'_el_temp_p = e(Pvals)

	
	foreach s in be se pv rpv wpv {
		matrix HNC1c_`i'_el_`s' = J(7,1,.)
	}

	foreach j in 1 2 3 4 5 6 7 {
		* beta
		matrix HNC1c_`i'_el_be[`j',1] = HNC1c_`i'_el_temp[1,`j']
		* standard error
		matrix HNC1c_`i'_el_se[`j',1] = HNC1c_`i'_el_temp[2,`j']
		* p value
		matrix HNC1c_`i'_el_pv[`j',1] = HNC1c_`i'_el_temp[4,`j']
		matrix HNC1c_`i'_el_wpv[`j',1] = HNC1c_`i'_el_temp_p[`j',1]
	}

*	cgmwildboot `i' treatment wrongDT cheating wrongTshort wrongTlong dum_grade, ///
*	cluster(school_no) bootcluster(school_no) null(0 . . . . . ) reps(999) seed(1)


	
}



foreach s in be se pv rpv r2 obs wpv {
	matrix HNC1c_`s' = HNC1c_DT_per_min_post_`s', HNC1c_DT_score_post_`s', ///
	HNC1c_DT_time_post_`s', HNC1c_ptsel_overall_score_`s', ///
	HNC1c_rosen_el_`s', HNC1c_cpcs_el_`s'
}









*HNCr1: [H]eterogeneous [ANC]OVA, [r]osenberg scale, 1 means high-high group



foreach i in DT_per_min DT_score DT_time  {

	 regress `i'_post treatment `i'_pre_miss if `i'_dum_miss == 0 & above_cpcs_update == 0 & above_dtcog_update == 1 , cluster(school_no)

	matrix HNC2c_`i'_post_temp = r(table)
	matrix HNC2c_`i'_post_r2 = e(r2)
	matrix HNC2c_`i'_post_obs = e(N)

	 cgmwildboot_2 `i'_post treatment `i'_pre_miss if `i'_dum_miss == 0 & above_cpcs_update == 0 & above_dtcog_update == 1 , cluster(school_no) bootcluster(school_no) null(0 .) reps(999) seed(1)
	matrix HNC2c_`i'_post_temp_p = e(Pvals)

	
	foreach s in be se pv rpv wpv {
		matrix HNC2c_`i'_post_`s' = J(7,1,.)
	}

	foreach j in 1 2 3 4 5 6 7 {
		* beta
		matrix HNC2c_`i'_post_be[`j',1] = HNC2c_`i'_post_temp[1,`j']
		* standard error
		matrix HNC2c_`i'_post_se[`j',1] = HNC2c_`i'_post_temp[2,`j']
		* p value
		matrix HNC2c_`i'_post_pv[`j',1] = HNC2c_`i'_post_temp[4,`j']
		matrix HNC2c_`i'_post_wpv[`j',1] = HNC2c_`i'_post_temp_p[`j',1]
	}

*	cgmwildboot `i' treatment wrongDT cheating wrongTshort wrongTlong dum_grade, ///
*	cluster(school_no) bootcluster(school_no) null(0 . . . . . ) reps(999) seed(1)


	
}

foreach i in ptsel_overall_score {

	 regress `i' treatment pts_pre_miss if pts_dum_miss == 0 & above_cpcs_update == 0 & above_ptcog_update == 1, cluster(school_no)

	matrix HNC2c_`i'_temp = r(table)
	matrix HNC2c_`i'_r2 = e(r2)
	matrix HNC2c_`i'_obs = e(N)

	 cgmwildboot_2 `i' treatment pts_pre_miss if pts_dum_miss == 0 & above_cpcs_update == 0 & above_ptcog_update == 1, cluster(school_no) bootcluster(school_no) null(0 .) reps(999) seed(1)
	matrix HNC2c_`i'_temp_p = e(Pvals)

	
	foreach s in be se pv rpv wpv {
		matrix HNC2c_`i'_`s' = J(7,1,.)
	}

	foreach j in 1 2 3 4 5 6 7 {
		* beta
		matrix HNC2c_`i'_be[`j',1] = HNC2c_`i'_temp[1,`j']
		* standard error
		matrix HNC2c_`i'_se[`j',1] = HNC2c_`i'_temp[2,`j']
		* p value
		matrix HNC2c_`i'_pv[`j',1] = HNC2c_`i'_temp[4,`j']
		matrix HNC2c_`i'_wpv[`j',1] = HNC2c_`i'_temp_p[`j',1]
	}

*	cgmwildboot `i' treatment wrongDT cheating wrongTshort wrongTlong dum_grade, ///
*	cluster(school_no) bootcluster(school_no) null(0 . . . . . ) reps(999) seed(1)


	
}




foreach i in rosen cpcs {

	 regress `i'_el treatment `i'_pre_miss if `i'_dum_miss == 0 & above_cpcs_update == 0 & above_ptcog_update == 1, cluster(school_no)

	matrix HNC2c_`i'_el_temp = r(table)
	matrix HNC2c_`i'_el_r2 = e(r2)
	matrix HNC2c_`i'_el_obs = e(N)

	 cgmwildboot_2 `i'_el treatment `i'_pre_miss if `i'_dum_miss == 0 &  above_cpcs_update == 0 & above_ptcog_update == 1, cluster(school_no) bootcluster(school_no) null(0 .) reps(999) seed(1)
	matrix HNC2c_`i'_el_temp_p = e(Pvals)

	
	foreach s in be se pv rpv wpv {
		matrix HNC2c_`i'_el_`s' = J(7,1,.)
	}

	foreach j in 1 2 3 4 5 6 7 {
		* beta
		matrix HNC2c_`i'_el_be[`j',1] = HNC2c_`i'_el_temp[1,`j']
		* standard error
		matrix HNC2c_`i'_el_se[`j',1] = HNC2c_`i'_el_temp[2,`j']
		* p value
		matrix HNC2c_`i'_el_pv[`j',1] = HNC2c_`i'_el_temp[4,`j']
		matrix HNC2c_`i'_el_wpv[`j',1] = HNC2c_`i'_el_temp_p[`j',1]
	}

*	cgmwildboot `i' treatment wrongDT cheating wrongTshort wrongTlong dum_grade, ///
*	cluster(school_no) bootcluster(school_no) null(0 . . . . . ) reps(999) seed(1)


	
}



foreach s in be se pv rpv r2 obs wpv {
	matrix HNC2c_`s' = HNC2c_DT_per_min_post_`s', HNC2c_DT_score_post_`s', ///
	HNC2c_DT_time_post_`s', HNC2c_ptsel_overall_score_`s', ///
	HNC2c_rosen_el_`s', HNC2c_cpcs_el_`s'
}









*HNCr1: [H]eterogeneous [ANC]OVA, [r]osenberg scale, 1 means high-high group



foreach i in DT_per_min DT_score DT_time  {

	 regress `i'_post treatment `i'_pre_miss if `i'_dum_miss == 0 & above_cpcs_update == 1 & above_dtcog_update == 0 , cluster(school_no)

	matrix HNC3c_`i'_post_temp = r(table)
	matrix HNC3c_`i'_post_r2 = e(r2)
	matrix HNC3c_`i'_post_obs = e(N)

	 cgmwildboot_2 `i'_post treatment `i'_pre_miss if `i'_dum_miss == 0 & above_cpcs_update == 1 & above_dtcog_update == 0 , cluster(school_no) bootcluster(school_no) null(0 .) reps(999) seed(1)
	matrix HNC3c_`i'_post_temp_p = e(Pvals)

	
	foreach s in be se pv rpv wpv {
		matrix HNC3c_`i'_post_`s' = J(7,1,.)
	}

	foreach j in 1 2 3 4 5 6 7 {
		* beta
		matrix HNC3c_`i'_post_be[`j',1] = HNC3c_`i'_post_temp[1,`j']
		* standard error
		matrix HNC3c_`i'_post_se[`j',1] = HNC3c_`i'_post_temp[2,`j']
		* p value
		matrix HNC3c_`i'_post_pv[`j',1] = HNC3c_`i'_post_temp[4,`j']
		matrix HNC3c_`i'_post_wpv[`j',1] = HNC3c_`i'_post_temp_p[`j',1]
	}

*	cgmwildboot `i' treatment wrongDT cheating wrongTshort wrongTlong dum_grade, ///
*	cluster(school_no) bootcluster(school_no) null(0 . . . . . ) reps(999) seed(1)


	
}

foreach i in ptsel_overall_score {

	 regress `i' treatment pts_pre_miss if pts_dum_miss == 0 &  above_cpcs_update == 1 & above_ptcog_update == 0, cluster(school_no)

	matrix HNC3c_`i'_temp = r(table)
	matrix HNC3c_`i'_r2 = e(r2)
	matrix HNC3c_`i'_obs = e(N)

	 cgmwildboot_2 `i' treatment pts_pre_miss if pts_dum_miss == 0 &  above_cpcs_update == 1 & above_ptcog_update == 0, cluster(school_no) bootcluster(school_no) null(0 .) reps(999) seed(1)
	matrix HNC3c_`i'_temp_p = e(Pvals)

	
	foreach s in be se pv rpv wpv {
		matrix HNC3c_`i'_`s' = J(7,1,.)
	}

	foreach j in 1 2 3 4 5 6 7 {
		* beta
		matrix HNC3c_`i'_be[`j',1] = HNC3c_`i'_temp[1,`j']
		* standard error
		matrix HNC3c_`i'_se[`j',1] = HNC3c_`i'_temp[2,`j']
		* p value
		matrix HNC3c_`i'_pv[`j',1] = HNC3c_`i'_temp[4,`j']
		matrix HNC3c_`i'_wpv[`j',1] = HNC3c_`i'_temp_p[`j',1]
	}

*	cgmwildboot `i' treatment wrongDT cheating wrongTshort wrongTlong dum_grade, ///
*	cluster(school_no) bootcluster(school_no) null(0 . . . . . ) reps(999) seed(1)


	
}




foreach i in rosen cpcs {

	 regress `i'_el treatment `i'_pre_miss if `i'_dum_miss == 0 & above_cpcs_update == 1 & above_ptcog_update == 0, cluster(school_no)

	matrix HNC3c_`i'_el_temp = r(table)
	matrix HNC3c_`i'_el_r2 = e(r2)
	matrix HNC3c_`i'_el_obs = e(N)

	 cgmwildboot_2 `i'_el treatment `i'_pre_miss if `i'_dum_miss == 0 & above_cpcs_update == 1 & above_ptcog_update == 0, cluster(school_no) bootcluster(school_no) null(0 .) reps(999) seed(1)
	matrix HNC3c_`i'_el_temp_p = e(Pvals)

	
	foreach s in be se pv rpv wpv {
		matrix HNC3c_`i'_el_`s' = J(7,1,.)
	}

	foreach j in 1 2 3 4 5 6 7 {
		* beta
		matrix HNC3c_`i'_el_be[`j',1] = HNC3c_`i'_el_temp[1,`j']
		* standard error
		matrix HNC3c_`i'_el_se[`j',1] = HNC3c_`i'_el_temp[2,`j']
		* p value
		matrix HNC3c_`i'_el_pv[`j',1] = HNC3c_`i'_el_temp[4,`j']
		matrix HNC3c_`i'_el_wpv[`j',1] = HNC3c_`i'_el_temp_p[`j',1]
	}

*	cgmwildboot `i' treatment wrongDT cheating wrongTshort wrongTlong dum_grade, ///
*	cluster(school_no) bootcluster(school_no) null(0 . . . . . ) reps(999) seed(1)


	
}



foreach s in be se pv rpv r2 obs wpv {
	matrix HNC3c_`s' = HNC3c_DT_per_min_post_`s', HNC3c_DT_score_post_`s', ///
	HNC3c_DT_time_post_`s', HNC3c_ptsel_overall_score_`s', ///
	HNC3c_rosen_el_`s', HNC3c_cpcs_el_`s'
}








*HNCr1: [H]eterogeneous [ANC]OVA, [r]osenberg scale, 1 means high-high group



foreach i in DT_per_min DT_score DT_time  {

	 regress `i'_post treatment `i'_pre_miss if `i'_dum_miss == 0 &  above_cpcs_update == 0 & above_dtcog_update == 0 , cluster(school_no)

	matrix HNC4c_`i'_post_temp = r(table)
	matrix HNC4c_`i'_post_r2 = e(r2)
	matrix HNC4c_`i'_post_obs = e(N)

	 cgmwildboot_2 `i'_post treatment `i'_pre_miss if `i'_dum_miss == 0 &  above_cpcs_update == 0 & above_dtcog_update == 0 , cluster(school_no) bootcluster(school_no) null(0 .) reps(999) seed(1)
	matrix HNC4c_`i'_post_temp_p = e(Pvals)

	
	foreach s in be se pv rpv wpv {
		matrix HNC4c_`i'_post_`s' = J(7,1,.)
	}

	foreach j in 1 2 3 4 5 6 7 {
		* beta
		matrix HNC4c_`i'_post_be[`j',1] = HNC4c_`i'_post_temp[1,`j']
		* standard error
		matrix HNC4c_`i'_post_se[`j',1] = HNC4c_`i'_post_temp[2,`j']
		* p value
		matrix HNC4c_`i'_post_pv[`j',1] = HNC4c_`i'_post_temp[4,`j']
		matrix HNC4c_`i'_post_wpv[`j',1] = HNC4c_`i'_post_temp_p[`j',1]
	}

*	cgmwildboot `i' treatment wrongDT cheating wrongTshort wrongTlong dum_grade, ///
*	cluster(school_no) bootcluster(school_no) null(0 . . . . . ) reps(999) seed(1)


	
}

foreach i in ptsel_overall_score {

	 regress `i' treatment pts_pre_miss if pts_dum_miss == 0 & above_cpcs_update == 0 & above_ptcog_update == 0, cluster(school_no)

	matrix HNC4c_`i'_temp = r(table)
	matrix HNC4c_`i'_r2 = e(r2)
	matrix HNC4c_`i'_obs = e(N)

	 cgmwildboot_2 `i' treatment pts_pre_miss if pts_dum_miss == 0 & above_cpcs_update == 0 & above_ptcog_update == 0, cluster(school_no) bootcluster(school_no) null(0 .) reps(999) seed(1)
	matrix HNC4c_`i'_temp_p = e(Pvals)

	
	foreach s in be se pv rpv wpv {
		matrix HNC4c_`i'_`s' = J(7,1,.)
	}

	foreach j in 1 2 3 4 5 6 7 {
		* beta
		matrix HNC4c_`i'_be[`j',1] = HNC4c_`i'_temp[1,`j']
		* standard error
		matrix HNC4c_`i'_se[`j',1] = HNC4c_`i'_temp[2,`j']
		* p value
		matrix HNC4c_`i'_pv[`j',1] = HNC4c_`i'_temp[4,`j']
		matrix HNC4c_`i'_wpv[`j',1] = HNC4c_`i'_temp_p[`j',1]
	}

*	cgmwildboot `i' treatment wrongDT cheating wrongTshort wrongTlong dum_grade, ///
*	cluster(school_no) bootcluster(school_no) null(0 . . . . . ) reps(999) seed(1)


	
}




foreach i in rosen cpcs {

	 regress `i'_el treatment `i'_pre_miss if `i'_dum_miss == 0 & above_cpcs_update == 0 & above_ptcog_update == 0, cluster(school_no)

	matrix HNC4c_`i'_el_temp = r(table)
	matrix HNC4c_`i'_el_r2 = e(r2)
	matrix HNC4c_`i'_el_obs = e(N)

	 cgmwildboot_2 `i'_el treatment `i'_pre_miss if `i'_dum_miss == 0 & above_cpcs_update == 0 & above_ptcog_update == 0, cluster(school_no) bootcluster(school_no) null(0 .) reps(999) seed(1)
	matrix HNC4c_`i'_el_temp_p = e(Pvals)

	
	foreach s in be se pv rpv wpv {
		matrix HNC4c_`i'_el_`s' = J(7,1,.)
	}

	foreach j in 1 2 3 4 5 6 7 {
		* beta
		matrix HNC4c_`i'_el_be[`j',1] = HNC4c_`i'_el_temp[1,`j']
		* standard error
		matrix HNC4c_`i'_el_se[`j',1] = HNC4c_`i'_el_temp[2,`j']
		* p value
		matrix HNC4c_`i'_el_pv[`j',1] = HNC4c_`i'_el_temp[4,`j']
		matrix HNC4c_`i'_el_wpv[`j',1] = HNC4c_`i'_el_temp_p[`j',1]
	}

*	cgmwildboot `i' treatment wrongDT cheating wrongTshort wrongTlong dum_grade, ///
*	cluster(school_no) bootcluster(school_no) null(0 . . . . . ) reps(999) seed(1)


	
}



foreach s in be se pv rpv r2 obs wpv {
	matrix HNC4c_`s' = HNC4c_DT_per_min_post_`s', HNC4c_DT_score_post_`s', ///
	HNC4c_DT_time_post_`s', HNC4c_ptsel_overall_score_`s', ///
	HNC4c_rosen_el_`s', HNC4c_cpcs_el_`s'
}






































forvalues n = 1/4 {
foreach j in r c {
forvalues item = 1/3 {
		forvalues scale = 1/6 {
		if HNC`n'`j'_pv[`item', `scale']<=0.01 {
			local nhancstar`n'`j'_`item'`scale' %3s "***"
		}
		else if (HNC`n'`j'_pv[`item', `scale']>0.01) & (HNC`n'`j'_pv[`item', `scale']<=0.05) {
			local nhancstar`n'`j'_`item'`scale' %2s "**"
		}
		else if (HNC`n'`j'_pv[`item', `scale']>0.05) & (HNC`n'`j'_pv[`item', `scale']<=0.10) {
			local nhancstar`n'`j'_`item'`scale' %1s "*"
		}
		else {
			local nhancstar`n'`j'_`item'`scale'  ""
		}
	} // forvalues `scale' loop

}  // forvalues `item' loop


} // forvalues `j' loop
} // forvalues `n' loop




forvalues n = 1/4 {
foreach j in r c {
forvalues item = 1/2 {
		forvalues scale = 1/6 {
		if HNC`n'`j'_pv[`item', `scale']<=0.01 {
			local hancstar`n'`j'_`item'`scale' %3s "***"
		}
		else if (HNC`n'`j'_pv[`item', `scale']>0.01) & (HNC`n'`j'_pv[`item', `scale']<=0.05) {
			local hancstar`n'`j'_`item'`scale' %2s "**"
		}
		else if (HNC`n'`j'_pv[`item', `scale']>0.05) & (HNC`n'`j'_pv[`item', `scale']<=0.10) {
			local hancstar`n'`j'_`item'`scale' %1s "*"
		}
		else {
			local hancstar`n'`j'_`item'`scale'  ""
		}
	} // forvalues `scale' loop

}  // forvalues `item' loop


} // forvalues `j' loop
} // forvalues `n' loop







tempname hh
file open `hh' using "$pardir/table3.tex", write replace
file write `hh' "" _newline
file write `hh' "% Date: `c(current_date)'" _newline
file write `hh' "% Time: `c(current_time)'" _newline
file write `hh' "" _newline



file write `hh' "\begin{sidewaystable}[tph!]\footnotesize" _newline
file write `hh' "  \centering" _newline
file write `hh' "  \caption{Heterogeneous Impact of Kumon on Students' Learning Outcomes: ANCOVA Specification}" _newline
file write `hh' "\label{tab:DID_hetero_ancova}" _newline
file write `hh' "\scalebox{0.6}{" _newline
file write `hh' "\begin{threeparttable}" _newline
file write `hh' "\begin{tabular}{lccccccccccccc}\toprule" _newline
file write `hh' " \multicolumn{1}{l}{ } & \multicolumn{6}{c}{Initial RSES Index}                              &  & \multicolumn{6}{c}{Initial CPCS Index}                              \\\cmidrule{2-7} \cmidrule{9-14}" _newline
file write `hh' " \multicolumn{1}{l}{ } & \multicolumn{3}{c}{Initial DT Score}  && \multicolumn{2}{c}{Initial PTSII-C Score}     & & \multicolumn{3}{c}{Initial DT Score}  && \multicolumn{2}{c}{Initial PTSII-C Score}    \\\cmidrule{2-4} \cmidrule{6-7} \cmidrule{9-11} \cmidrule{13-14}" _newline
file write `hh' "Dependent Variable & DT Score per min\textsuperscript{a} & DT Score & DT Time   && PTSII-C Score\textsuperscript{b} & RSES\textsuperscript{c}      &  & DT Score per min\textsuperscript{a} & DT Score & DT Time   && PTSII-C Score\textsuperscript{b} & CPCS\textsuperscript{c} \\" _newline
file write `hh' " & (1) & (2) & (3) && (4) & (5) & & (6) & (7) & (8) && (9) & (10)     \\\midrule\midrule" _newline
file write `hh' "\multicolumn{12}{l}{\textbf{Panel A: High Initial Cognitive and High Initial Non-cognitive Group}\textsuperscript{d}} \\\midrule" _newline
file write `hh' "Treatment           &  "  %04.3f (HNC1r_be[1, 1]) `hancstar1r_11' "  &  "  %04.3f (HNC1r_be[1, 2]) `hancstar1r_12' "  &  "  %04.3f (HNC1r_be[1, 3]) `hancstar1r_13' "  &&  "  %04.3f (HNC1r_be[1, 4]) `hancstar1r_14' "  &  "  %04.3f (HNC1r_be[1, 5]) `hancstar1r_15' "  &&  "  %04.3f (HNC1c_be[1, 1]) `hancstar1c_11' "  &  "  %04.3f (HNC1c_be[1, 2]) `hancstar1c_12' "  &  "  %04.3f (HNC1c_be[1, 3]) `hancstar1c_13' "  &&  "  %04.3f (HNC1c_be[1, 4]) `hancstar1c_14' "  &  "  %04.3f (HNC1c_be[1, 6]) `hancstar1c_16'  " \\" _newline
file write `hh' "                    & ("  %04.3f (HNC1r_se[1, 1])               ") & ("  %04.3f (HNC1r_se[1, 2])               ") & ("  %04.3f (HNC1r_se[1, 3])               ") && ("  %04.3f (HNC1r_se[1, 4])               ") & ("  %04.3f (HNC1r_se[1, 5])               ") && ("  %04.3f (HNC1r_se[1, 1])               ") & ("  %04.3f (HNC1c_se[1, 2])               ") & ("  %04.3f (HNC1c_se[1, 3])               ") && ("  %04.3f (HNC1c_se[1, 4])               ") & ("  %04.3f (HNC1c_se[1, 6])               ") \\" _newline
file write `hh' "Baseline Outcome    &  "  %04.3f (HNC1r_be[2, 1]) `hancstar1r_21' "  &  "  %04.3f (HNC1r_be[2, 2]) `hancstar1r_22' "  &  "  %04.3f (HNC1r_be[2, 3]) `hancstar1r_23' "  &&  "  %04.3f (HNC1r_be[2, 4]) `hancstar1r_24' "  &  "  %04.3f (HNC1r_be[2, 5]) `hancstar1r_25' "  &&  "  %04.3f (HNC1c_be[2, 1]) `hancstar1c_21' "  &  "  %04.3f (HNC1c_be[2, 2]) `hancstar1c_22' "  &  "  %04.3f (HNC1c_be[2, 3]) `hancstar1c_23' "  &&  "  %04.3f (HNC1c_be[2, 4]) `hancstar1c_24' "  &  "  %04.3f (HNC1c_be[2, 6]) `hancstar1c_26'  " \\" _newline
file write `hh' "                    & ("  %04.3f (HNC1r_se[2, 1])               ") & ("  %04.3f (HNC1r_se[2, 2])               ") & ("  %04.3f (HNC1r_se[2, 3])               ") && ("  %04.3f (HNC1r_se[2, 4])               ") & ("  %04.3f (HNC1r_se[2, 5])               ") && ("  %04.3f (HNC1c_se[2, 1])               ") & ("  %04.3f (HNC1c_se[2, 2])               ") & ("  %04.3f (HNC1c_se[2, 3])               ") && ("  %04.3f (HNC1c_se[2, 4])               ") & ("  %04.3f (HNC1c_se[2, 6])               ") \\" _newline
file write `hh' "Constant            &  "  %04.3f (HNC1r_be[3, 1]) `nhancstar1r_31' "  &  "  %04.3f (HNC1r_be[3, 2]) `nhancstar1r_32' "  &  "  %04.3f (HNC1r_be[3, 3]) `nhancstar1r_33' "  &&  "  %04.3f (HNC1r_be[3, 4]) `nhancstar1r_34' "  &  "  %04.3f (HNC1r_be[3, 5]) `nhancstar1r_35' "  &&  "  %04.3f (HNC1c_be[3, 1]) `nhancstar1c_31' "  &  "  %04.3f (HNC1c_be[3, 2]) `nhancstar1c_32' "  &  "  %04.3f (HNC1c_be[3, 3]) `nhancstar1c_33' "  &&  "  %04.3f (HNC1c_be[3, 4]) `nhancstar1c_34' "  &  "  %04.3f (HNC1c_be[3, 6]) `nhancstar1c_36'  " \\" _newline
file write `hh' "                    & ("  %04.3f (HNC1r_se[3, 1])               ") & ("  %04.3f (HNC1r_se[3, 2])               ") & ("  %04.3f (HNC1r_se[3, 3])               ") && ("  %04.3f (HNC1r_se[3, 4])               ") & ("  %04.3f (HNC1r_se[3, 5])               ") && ("  %04.3f (HNC1c_se[3, 1])               ") & ("  %04.3f (HNC1c_se[3, 2])               ") & ("  %04.3f (HNC1c_se[3, 3])               ") && ("  %04.3f (HNC1c_se[3, 4])               ") & ("  %04.3f (HNC1c_se[3, 6])               ") \\" _newline
file write `hh' "                    &                  &          &           &&               &           &  &                  &          &          &&               &           \\\midrule" _newline
file write `hh' "Num of Obs.         &  "         (HNC1r_obs[1, 1])              "  &  "         (HNC1r_obs[1, 2])              "  &  "         (HNC1r_obs[1, 3])              "  &&  "         (HNC1r_obs[1, 4])              "  &  "         (HNC1r_obs[1, 5])              "  &&  "         (HNC1c_obs[1, 1])              "  &  "         (HNC1c_obs[1, 2])              "  &  "         (HNC1c_obs[1, 3])              "  &&  "         (HNC1c_obs[1, 4])              "  &  "         (HNC1c_obs[1, 6])               "  \\" _newline
file write `hh' "R-squared           &  "  %04.3f (HNC1r_r2[1, 1])               "  &  "  %04.3f (HNC1r_r2[1, 2])               "  &  "  %04.3f (HNC1r_r2[1, 3])               "  &&  "  %04.3f (HNC1r_r2[1, 4])               "  &  "  %04.3f (HNC1r_r2[1, 5])               "  &&  "  %04.3f (HNC1c_r2[1, 1])               "  &  "  %04.3f (HNC1c_r2[1, 2])               "  &  "  %04.3f (HNC1c_r2[1, 3])               "  &&  "  %04.3f (HNC1c_r2[1, 4])               "  &  "  %04.3f (HNC1c_r2[1, 6])               "  \\" _newline
file write `hh' "                    &                  &          &           &&               &           &  &                  &          &          &&               &           \\\midrule" _newline









file write `hh' "\multicolumn{12}{l}{\textbf{Panel B: High Initial Cognitive and Low Initial Non-cognitive Group}\textsuperscript{d}}                                                                          \\\midrule" _newline

file write `hh' "Treatment           &  "  %04.3f (HNC2r_be[1, 1]) `hancstar2r_11' "  &  "  %04.3f (HNC2r_be[1, 2]) `hancstar2r_12' "  &  "  %04.3f (HNC2r_be[1, 3]) `hancstar2r_13' "  &&  "  %04.3f (HNC2r_be[1, 4]) `hancstar2r_14' "  &  "  %04.3f (HNC2r_be[1, 5]) `hancstar2r_15' "  &&  "  %04.3f (HNC2c_be[1, 1]) `hancstar2c_11' "  &  "  %04.3f (HNC2c_be[1, 2]) `hancstar2c_12' "  &  "  %04.3f (HNC2c_be[1, 3]) `hancstar2c_13' "  &&  "  %04.3f (HNC2c_be[1, 4]) `hancstar2c_14' "  &  "  %04.3f (HNC2c_be[1, 6]) `hancstar2c_16'  " \\" _newline
file write `hh' "                    & ("  %04.3f (HNC2r_se[1, 1])               ") & ("  %04.3f (HNC2r_se[1, 2])               ") & ("  %04.3f (HNC2r_se[1, 3])               ") && ("  %04.3f (HNC2r_se[1, 4])               ") & ("  %04.3f (HNC2r_se[1, 5])               ") && ("  %04.3f (HNC2r_se[1, 1])               ") & ("  %04.3f (HNC2c_se[1, 2])               ") & ("  %04.3f (HNC2c_se[1, 3])               ") && ("  %04.3f (HNC2c_se[1, 4])               ") & ("  %04.3f (HNC2c_se[1, 6])               ") \\" _newline
file write `hh' "Baseline Outcome    &  "  %04.3f (HNC2r_be[2, 1]) `hancstar2r_21' "  &  "  %04.3f (HNC2r_be[2, 2]) `hancstar2r_22' "  &  "  %04.3f (HNC2r_be[2, 3]) `hancstar2r_23' "  &&  "  %04.3f (HNC2r_be[2, 4]) `hancstar2r_24' "  &  "  %04.3f (HNC2r_be[2, 5]) `hancstar2r_25' "  &&  "  %04.3f (HNC2c_be[2, 1]) `hancstar2c_21' "  &  "  %04.3f (HNC2c_be[2, 2]) `hancstar2c_22' "  &  "  %04.3f (HNC2c_be[2, 3]) `hancstar2c_23' "  &&  "  %04.3f (HNC2c_be[2, 4]) `hancstar2c_24' "  &  "  %04.3f (HNC2c_be[2, 6]) `hancstar2c_26'  " \\" _newline
file write `hh' "                    & ("  %04.3f (HNC2r_se[2, 1])               ") & ("  %04.3f (HNC2r_se[2, 2])               ") & ("  %04.3f (HNC2r_se[2, 3])               ") && ("  %04.3f (HNC2r_se[2, 4])               ") & ("  %04.3f (HNC2r_se[2, 5])               ") && ("  %04.3f (HNC2c_se[2, 1])               ") & ("  %04.3f (HNC2c_se[2, 2])               ") & ("  %04.3f (HNC2c_se[2, 3])               ") && ("  %04.3f (HNC2c_se[2, 4])               ") & ("  %04.3f (HNC2c_se[2, 6])               ") \\" _newline
file write `hh' "Constant            &  "  %04.3f (HNC2r_be[3, 1]) `nhancstar2r_31' "  &  "  %04.3f (HNC2r_be[3, 2]) `nhancstar2r_32' "  &  "  %04.3f (HNC2r_be[3, 3]) `nhancstar2r_33' "  &&  "  %04.3f (HNC2r_be[3, 4]) `nhancstar2r_34' "  &  "  %04.3f (HNC2r_be[3, 5]) `nhancstar2r_35' "  &&  "  %04.3f (HNC2c_be[3, 1]) `nhancstar2c_31' "  &  "  %04.3f (HNC2c_be[3, 2]) `nhancstar2c_32' "  &  "  %04.3f (HNC2c_be[3, 3]) `nhancstar2c_33' "  &&  "  %04.3f (HNC2c_be[3, 4]) `nhancstar2c_34' "  &  "  %04.3f (HNC2c_be[3, 6]) `nhancstar2c_36'  " \\" _newline
file write `hh' "                    & ("  %04.3f (HNC2r_se[3, 1])               ") & ("  %04.3f (HNC2r_se[3, 2])               ") & ("  %04.3f (HNC2r_se[3, 3])               ") && ("  %04.3f (HNC2r_se[3, 4])               ") & ("  %04.3f (HNC2r_se[3, 5])               ") && ("  %04.3f (HNC2c_se[3, 1])               ") & ("  %04.3f (HNC2c_se[3, 2])               ") & ("  %04.3f (HNC2c_se[3, 3])               ") && ("  %04.3f (HNC2c_se[3, 4])               ") & ("  %04.3f (HNC2c_se[3, 6])               ") \\" _newline
file write `hh' "                    &                  &          &           &&               &           &  &                  &          &          &&               &           \\\midrule" _newline
file write `hh' "Num of Obs.         &  "         (HNC2r_obs[1, 1])              "  &  "         (HNC2r_obs[1, 2])              "  &  "         (HNC2r_obs[1, 3])              "  &&  "         (HNC2r_obs[1, 4])              "  &  "         (HNC2r_obs[1, 5])              "  &&  "         (HNC2c_obs[1, 1])              "  &  "         (HNC2c_obs[1, 2])              "  &  "         (HNC2c_obs[1, 3])              "  &&  "         (HNC2c_obs[1, 4])              "  &  "         (HNC2c_obs[1, 6])               "  \\" _newline
file write `hh' "R-squared           &  "  %04.3f (HNC2r_r2[1, 1])               "  &  "  %04.3f (HNC2r_r2[1, 2])               "  &  "  %04.3f (HNC2r_r2[1, 3])               "  &&  "  %04.3f (HNC2r_r2[1, 4])               "  &  "  %04.3f (HNC2r_r2[1, 5])               "  &&  "  %04.3f (HNC2c_r2[1, 1])               "  &  "  %04.3f (HNC2c_r2[1, 2])               "  &  "  %04.3f (HNC2c_r2[1, 3])               "  &&  "  %04.3f (HNC2c_r2[1, 4])               "  &  "  %04.3f (HNC2c_r2[1, 6])               "  \\" _newline
file write `hh' "                    &                  &          &           &&               &           &  &                  &          &          &&               &           \\\midrule" _newline






file write `hh' "\multicolumn{12}{l}{\textbf{Panel C: Low Initial Cognitive and High Initial Non-cognitive Group}\textsuperscript{d}}                                                                          \\\midrule" _newline


file write `hh' "Treatment           &  "  %04.3f (HNC3r_be[1, 1]) `hancstar3r_11' "  &  "  %04.3f (HNC3r_be[1, 2]) `hancstar3r_12' "  &  "  %04.3f (HNC3r_be[1, 3]) `hancstar3r_13' "  &&  "  %04.3f (HNC3r_be[1, 4]) `hancstar3r_14' "  &  "  %04.3f (HNC3r_be[1, 5]) `hancstar3r_15' "  &&  "  %04.3f (HNC3c_be[1, 1]) `hancstar3c_11' "  &  "  %04.3f (HNC3c_be[1, 2]) `hancstar3c_12' "  &  "  %04.3f (HNC3c_be[1, 3]) `hancstar3c_13' "  &&  "  %04.3f (HNC3c_be[1, 4]) `hancstar3c_14' "  &  "  %04.3f (HNC3c_be[1, 6]) `hancstar3c_16'  " \\" _newline
file write `hh' "                    & ("  %04.3f (HNC3r_se[1, 1])               ") & ("  %04.3f (HNC3r_se[1, 2])               ") & ("  %04.3f (HNC3r_se[1, 3])               ") && ("  %04.3f (HNC3r_se[1, 4])               ") & ("  %04.3f (HNC3r_se[1, 5])               ") && ("  %04.3f (HNC3r_se[1, 1])               ") & ("  %04.3f (HNC3c_se[1, 2])               ") & ("  %04.3f (HNC3c_se[1, 3])               ") && ("  %04.3f (HNC3c_se[1, 4])               ") & ("  %04.3f (HNC3c_se[1, 6])               ") \\" _newline
file write `hh' "Baseline Outcome    &  "  %04.3f (HNC3r_be[2, 1]) `hancstar3r_21' "  &  "  %04.3f (HNC3r_be[2, 2]) `hancstar3r_22' "  &  "  %04.3f (HNC3r_be[2, 3]) `hancstar3r_23' "  &&  "  %04.3f (HNC3r_be[2, 4]) `hancstar3r_24' "  &  "  %04.3f (HNC3r_be[2, 5]) `hancstar3r_25' "  &&  "  %04.3f (HNC3c_be[2, 1]) `hancstar3c_21' "  &  "  %04.3f (HNC3c_be[2, 2]) `hancstar3c_22' "  &  "  %04.3f (HNC3c_be[2, 3]) `hancstar3c_23' "  &&  "  %04.3f (HNC3c_be[2, 4]) `hancstar3c_24' "  &  "  %04.3f (HNC3c_be[2, 6]) `hancstar3c_26'  " \\" _newline
file write `hh' "                    & ("  %04.3f (HNC3r_se[2, 1])               ") & ("  %04.3f (HNC3r_se[2, 2])               ") & ("  %04.3f (HNC3r_se[2, 3])               ") && ("  %04.3f (HNC3r_se[2, 4])               ") & ("  %04.3f (HNC3r_se[2, 5])               ") && ("  %04.3f (HNC3c_se[2, 1])               ") & ("  %04.3f (HNC3c_se[2, 2])               ") & ("  %04.3f (HNC3c_se[2, 3])               ") && ("  %04.3f (HNC3c_se[2, 4])               ") & ("  %04.3f (HNC3c_se[2, 6])               ") \\" _newline
file write `hh' "Constant            &  "  %04.3f (HNC3r_be[3, 1]) `nhancstar3r_31' "  &  "  %04.3f (HNC3r_be[3, 2]) `nhancstar3r_32' "  &  "  %04.3f (HNC3r_be[3, 3]) `nhancstar3r_33' "  &&  "  %04.3f (HNC3r_be[3, 4]) `nhancstar3r_34' "  &  "  %04.3f (HNC3r_be[3, 5]) `nhancstar3r_35' "  &&  "  %04.3f (HNC3c_be[3, 1]) `nhancstar3c_31' "  &  "  %04.3f (HNC3c_be[3, 2]) `nhancstar3c_32' "  &  "  %04.3f (HNC3c_be[3, 3]) `nhancstar3c_33' "  &&  "  %04.3f (HNC3c_be[3, 4]) `nhancstar3c_34' "  &  "  %04.3f (HNC3c_be[3, 6]) `nhancstar3c_36'  " \\" _newline
file write `hh' "                    & ("  %04.3f (HNC3r_se[3, 1])               ") & ("  %04.3f (HNC3r_se[3, 2])               ") & ("  %04.3f (HNC3r_se[3, 3])               ") && ("  %04.3f (HNC3r_se[3, 4])               ") & ("  %04.3f (HNC3r_se[3, 5])               ") && ("  %04.3f (HNC3c_se[3, 1])               ") & ("  %04.3f (HNC3c_se[3, 2])               ") & ("  %04.3f (HNC3c_se[3, 3])               ") && ("  %04.3f (HNC3c_se[3, 4])               ") & ("  %04.3f (HNC3c_se[3, 6])               ") \\" _newline
file write `hh' "                    &                  &          &           &&               &           &  &                  &          &          &&               &           \\\midrule" _newline
file write `hh' "Num of Obs.         &  "         (HNC3r_obs[1, 1])              "  &  "         (HNC3r_obs[1, 2])              "  &  "         (HNC3r_obs[1, 3])              "  &&  "         (HNC3r_obs[1, 4])              "  &  "         (HNC3r_obs[1, 5])              "  &&  "         (HNC3c_obs[1, 1])              "  &  "         (HNC3c_obs[1, 2])              "  &  "         (HNC3c_obs[1, 3])              "  &&  "         (HNC3c_obs[1, 4])              "  &  "         (HNC3c_obs[1, 6])               "  \\" _newline
file write `hh' "R-squared           &  "  %04.3f (HNC3r_r2[1, 1])               "  &  "  %04.3f (HNC3r_r2[1, 2])               "  &  "  %04.3f (HNC3r_r2[1, 3])               "  &&  "  %04.3f (HNC3r_r2[1, 4])               "  &  "  %04.3f (HNC3r_r2[1, 5])               "  &&  "  %04.3f (HNC3c_r2[1, 1])               "  &  "  %04.3f (HNC3c_r2[1, 2])               "  &  "  %04.3f (HNC3c_r2[1, 3])               "  &&  "  %04.3f (HNC3c_r2[1, 4])               "  &  "  %04.3f (HNC3c_r2[1, 6])               "  \\" _newline
file write `hh' "                    &                  &          &           &&               &           &  &                  &          &          &&               &           \\\midrule" _newline






file write `hh' "\multicolumn{12}{l}{\textbf{Panel D: Low Initial Cognitive and Low Initial Non-cognitive Group}\textsuperscript{d}}                                                                           \\\midrule" _newline
file write `hh' "Treatment           &  "  %04.3f (HNC4r_be[1, 1]) `hancstar4r_11' "  &  "  %04.3f (HNC4r_be[1, 2]) `hancstar4r_12' "  &  "  %04.3f (HNC4r_be[1, 3]) `hancstar4r_13' "  &&  "  %04.3f (HNC4r_be[1, 4]) `hancstar4r_14' "  &  "  %04.3f (HNC4r_be[1, 5]) `hancstar4r_15' "  &&  "  %04.3f (HNC4c_be[1, 1]) `hancstar4c_11' "  &  "  %04.3f (HNC4c_be[1, 2]) `hancstar4c_12' "  &  "  %04.3f (HNC4c_be[1, 3]) `hancstar4c_13' "  &&  "  %04.3f (HNC4c_be[1, 4]) `hancstar4c_14' "  &  "  %04.3f (HNC4c_be[1, 6]) `hancstar4c_16'  " \\" _newline
file write `hh' "                    & ("  %04.3f (HNC4r_se[1, 1])               ") & ("  %04.3f (HNC4r_se[1, 2])               ") & ("  %04.3f (HNC4r_se[1, 3])               ") && ("  %04.3f (HNC4r_se[1, 4])               ") & ("  %04.3f (HNC4r_se[1, 5])               ") && ("  %04.3f (HNC4r_se[1, 1])               ") & ("  %04.3f (HNC4c_se[1, 2])               ") & ("  %04.3f (HNC4c_se[1, 3])               ") && ("  %04.3f (HNC4c_se[1, 4])               ") & ("  %04.3f (HNC4c_se[1, 6])               ") \\" _newline
file write `hh' "Baseline Outcome    &  "  %04.3f (HNC4r_be[2, 1]) `hancstar4r_21' "  &  "  %04.3f (HNC4r_be[2, 2]) `hancstar4r_22' "  &  "  %04.3f (HNC4r_be[2, 3]) `hancstar4r_23' "  &&  "  %04.3f (HNC4r_be[2, 4]) `hancstar4r_24' "  &  "  %04.3f (HNC4r_be[2, 5]) `hancstar4r_25' "  &&  "  %04.3f (HNC4c_be[2, 1]) `hancstar4c_21' "  &  "  %04.3f (HNC4c_be[2, 2]) `hancstar4c_22' "  &  "  %04.3f (HNC4c_be[2, 3]) `hancstar4c_23' "  &&  "  %04.3f (HNC4c_be[2, 4]) `hancstar4c_24' "  &  "  %04.3f (HNC4c_be[2, 6]) `hancstar4c_26'  " \\" _newline
file write `hh' "                    & ("  %04.3f (HNC4r_se[2, 1])               ") & ("  %04.3f (HNC4r_se[2, 2])               ") & ("  %04.3f (HNC4r_se[2, 3])               ") && ("  %04.3f (HNC4r_se[2, 4])               ") & ("  %04.3f (HNC4r_se[2, 5])               ") && ("  %04.3f (HNC4c_se[2, 1])               ") & ("  %04.3f (HNC4c_se[2, 2])               ") & ("  %04.3f (HNC4c_se[2, 3])               ") && ("  %04.3f (HNC4c_se[2, 4])               ") & ("  %04.3f (HNC4c_se[2, 6])               ") \\" _newline
file write `hh' "Constant            &  "  %04.3f (HNC4r_be[3, 1]) `nhancstar4r_31' "  &  "  %04.3f (HNC4r_be[3, 2]) `nhancstar4r_32' "  &  "  %04.3f (HNC4r_be[3, 3]) `nhancstar4r_33' "  &&  "  %04.3f (HNC4r_be[3, 4]) `nhancstar4r_34' "  &  "  %04.3f (HNC4r_be[3, 5]) `nhancstar4r_35' "  &&  "  %04.3f (HNC4c_be[3, 1]) `nhancstar4c_31' "  &  "  %04.3f (HNC4c_be[3, 2]) `nhancstar4c_32' "  &  "  %04.3f (HNC4c_be[3, 3]) `nhancstar4c_33' "  &&  "  %04.3f (HNC4c_be[3, 4]) `nhancstar4c_34' "  &  "  %04.3f (HNC4c_be[3, 6]) `nhancstar4c_36'  " \\" _newline
file write `hh' "                    & ("  %04.3f (HNC4r_se[3, 1])               ") & ("  %04.3f (HNC4r_se[3, 2])               ") & ("  %04.3f (HNC4r_se[3, 3])               ") && ("  %04.3f (HNC4r_se[3, 4])               ") & ("  %04.3f (HNC4r_se[3, 5])               ") && ("  %04.3f (HNC4c_se[3, 1])               ") & ("  %04.3f (HNC4c_se[3, 2])               ") & ("  %04.3f (HNC4c_se[3, 3])               ") && ("  %04.3f (HNC4c_se[3, 4])               ") & ("  %04.3f (HNC4c_se[3, 6])               ") \\" _newline
file write `hh' "                    &                  &          &           &&               &           &  &                  &          &          &&               &           \\\midrule" _newline
file write `hh' "Num of Obs.         &  "         (HNC4r_obs[1, 1])              "  &  "         (HNC4r_obs[1, 2])              "  &  "         (HNC4r_obs[1, 3])              "  &&  "         (HNC4r_obs[1, 4])              "  &  "         (HNC4r_obs[1, 5])              "  &&  "         (HNC4c_obs[1, 1])              "  &  "         (HNC4c_obs[1, 2])              "  &  "         (HNC4c_obs[1, 3])              "  &&  "         (HNC4c_obs[1, 4])              "  &  "         (HNC4c_obs[1, 6])               "  \\" _newline
file write `hh' "R-squared           &  "  %04.3f (HNC4r_r2[1, 1])               "  &  "  %04.3f (HNC4r_r2[1, 2])               "  &  "  %04.3f (HNC4r_r2[1, 3])               "  &&  "  %04.3f (HNC4r_r2[1, 4])               "  &  "  %04.3f (HNC4r_r2[1, 5])               "  &&  "  %04.3f (HNC4c_r2[1, 1])               "  &  "  %04.3f (HNC4c_r2[1, 2])               "  &  "  %04.3f (HNC4c_r2[1, 3])               "  &&  "  %04.3f (HNC4c_r2[1, 4])               "  &  "  %04.3f (HNC4c_r2[1, 6])               "  \\" _newline
file write `hh' "                    &                  &          &           &&               &           &  &                  &          &          &&               &           \\\midrule" _newline








file write `hh' "\end{tabular}" _newline
file write `hh' "\end{threeparttable}" _newline
file write `hh' "}" _newline
file write `hh' "\label{tab:addlabel}%" _newline
file write `hh' "\end{sidewaystable}" _newline



file write `hh' "" _newline
file write `hh' "" _newline
file write `hh' "" _newline
file write `hh' "" _newline

file close `hh'





























































